﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CubicFWNet.Data.Models;
using CubicFWNet.Data.SystemManager;
using CubicFWNet.Data.ViewModal;

namespace CubicFWNet.Application.SystemManager
{
    public class ExamineApp
    {
        private readonly ExamineRepository _service = new ExamineRepository();

        public int Add(Examine web)
        {
            return _service.Insert(web);
        }

        public int Update(Examine web)
        {
            return _service.Update(web);
        }

        public Examine GetSinglExamine(Guid id)
        {
            return _service.FindEntity(a => a.Id == id);
        }
        public Examine GetSinglExamineByItemId(Guid id)
        {
            return _service.FindEntity(a => a.ItemId == id);
        }

        public IEnumerable<ProductTechnologyView> GetList(int status, string productName, DateTime beginTime, DateTime endTime)
        {
            return _service.GetList(status,productName, beginTime, endTime).OrderByDescending(a => a.ApplyTime);
        }
    }
}
